<template>
  <div class="exam-page">
    <div
      v-for="item in types"
      :key="item.value"
      class="exam-card"
      @click="toDetail(item.value)"
    >
      <van-icon class="exam-card__icon--prefix" name="orders-o" />
      <span class="exam-card__title">{{ item.label }}</span>
      <van-icon name="arrow" />
    </div>
  </div>
</template>

<script>
import { Question_LIST, Eat_LIST } from "@/utils/Consant";
import { Icon } from "vant";
import Taro from "@tarojs/taro";
export default {
  components: {
    [Icon.name]: Icon
  },
  data() {
    return {
      types: [],
      loading: false
    };
  },
  onLoad(options) {
    this.type = options.type;
    Taro.setNavigationBarTitle({ title: options.title });
    this.loadMore(options.type);
  },
  methods: {
    async loadMore(type) {
      this.types = Question_LIST;
    },
    toDetail(item) {
      this.$store.commit("setExam", item);
      this.toPage("/pages/knowledge/videoList", {
        type: this.type,
        typeName: item
      });
    }
  }
};
</script>

<style lang="less">
.exam-page {
  min-height: 100vh;
  padding-top: 20px;
  padding-bottom: 40px;
  box-sizing: border-box;
  background-color: #f5f5f5;
}
.exam-card {
  background-color: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: inset 0 -2px 0 0 #f5f5f5;
  height: 150px;
  padding: 0 40px;

  font-size: 36px;
  color: #333333;

  &__title {
    flex: 1;
    font-weight: 500;
  }

  &__icon--prefix ~ &__title {
    margin-left: 10px;
  }

  &__icon--prefix {
    color: @primary;
    font-size: 60px;
  }
}
</style>
